/*
 * @Author: czy
 * @Date: 2021-04-29 08:00:28
 * @LastEditTime: 2021-04-29 16:43:18
 */
#include "exception.h"

#define JUMP_BUFFER_SIZE 200
static jmp_buf Jump_Buffers[JUMP_BUFFER_SIZE];
static int jump_flags[JUMP_BUFFER_SIZE]; 
static int jump_buffer_index = -1;

void add_jump_buffer_index(int i)
{
    if (i > 0)
    {
        jump_buffer_index++;
    } else if (i < 0)
    {
        jump_buffer_index--;
    }
}

int get_jump_buffer_index(void)
{
    return jump_buffer_index;
}

int get_jump_flags(int index)
{
    return jump_flags[index];
}

int set_jump_flags(int index, int value)
{
    jump_flags[index] = value;
}

jmp_buf *get_jump_buffer(void)
{
    return &Jump_Buffers[jump_buffer_index];
}
